package com.wipz.eoa.iphone.officesupplies;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.apache.commons.lang.StringUtils;

import com.wipz.eoa.iphone.BaseAction;

public class OfficeSuppliesInventoryAction extends BaseAction {
	private static final long serialVersionUID = 1L;
	
	private Map<String,Object> detail;//详情
	private List<Object> list;//列表
	
	public void setDetail(Map<String,Object> detail) {
		this.detail = detail;
	}
	public Map<String,Object> getDetail() {
		return detail;
	}
	public List<Object> getList() {
		return list;
	}
	public void setList(List<Object> list) {
		this.list = list;
	}
	private IOfficeSuppliesInventoryService officeSuppliesInventoryService;

	public void setOfficeSuppliesInventoryService(
			IOfficeSuppliesInventoryService officeSuppliesInventoryService) {
		this.officeSuppliesInventoryService = officeSuppliesInventoryService;
	}
	/**
	 * 列表
	 * @return
	 */
	public String list(){
		Map<String,Object> params=new HashMap<String,Object>();
		params.put("ASSETCODE", getRequest().getParameter("ASSETCODE"));
		params.put("ASSETNAME", getRequest().getParameter("ASSETNAME"));
		params.put("ASSETTYPECODE", getRequest().getParameter("ASSETTYPECODE"));
		params.put("APPLYDATE", getRequest().getParameter("APPLYDATE"));
		list=officeSuppliesInventoryService.queryList("officesuppliesInventory.queryList", params);
		return SUCCESS;
	}
	/**
	 * 详情
	 * @return
	 */
	public String detail(){
		String id=getRequest().getParameter("id");
		if(StringUtils.isNotEmpty(id)){
			Map params = new HashMap();
			params.put("ID", id);
			detail=(Map)officeSuppliesInventoryService.queryOne("officesuppliesInventory.queryByID", params);
		}
		return SUCCESS;
	}
	public String delete(){
		String id=getRequest().getParameter("id");
		if(StringUtils.isNotEmpty(id)){
			Map params = new HashMap();
			params.put("ID", id);
			detail=(Map)officeSuppliesInventoryService.queryOne("officesuppliesInventory.delete", params);
		}
		return SUCCESS;
	}
	public String updateOrInsert(){
		String id=getRequest().getParameter("id");
		if(!StringUtils.isNotEmpty(id)){
			officeSuppliesInventoryService.update("officesuppliesInventory.insert", getRequest().getParameterMap());
		}else{
			officeSuppliesInventoryService.insert("officesuppliesInventory.update", getRequest().getParameterMap());
		}
		return SUCCESS;
	}

}
